The regular expression limits that only numbers can be entered in the input box.
CodeAs follows:
Keyup = "This. value = This. value. Replace (/[^ \ D]/g,'') "on
Afterpaste = "This. value = This. value. Replace (/[^ \ D]/g,'') "name =" f_order
The regular expression limits that only numbers can be entered in the text box.
In many cases, we need to restrict the type of text box input content when creating a form. Below we use a regular expression to restrict the text box to enter
The previously written method has a defect. You can enter a space. Now, spaces are blocked. The space filtering function is added to the previous code. The Code is as follows:
The Code is as follows:
$ ("# Money"). bind ("propertychange",
JQuery controls that input can only input two digits and decimal places (amount), jqueryinput
Function num (obj ){Obj. value = obj. value. replace (/[^ \ d.]/g, ""); // clear characters other than "Number" and "."Obj. value = obj. value. replace (/^
The Code is as follows:Copy codeThe Code is as follows:$ ("# Money"). bind ("propertychange", function (){If (""! = This. value ){Var str = this. value. replace (/(^ \ s *) | (\ s * $)/g ,"");If (this. value! = Str)This. value = str;}If (isNaN
Class 1: Using System.Collections.Generic;Using System.Data;Using SYSTEM.WEB.MVC;Using System.IO;Using System.Web.UI.WebControls;Using System.Web;Using System.Web.UI;Using System.Drawing; Namespace Base.actionresult{public class
1. Converts lowercase letters to uppercase letters:
Or
2. Convert uppercase letters to lowercase letters automatically.
Or
3. Prevent text files from being cleared.
4. Press enter to move the cursor to the next input box.
5. It
We recommend that you search for and collect many common js judgment functions. We recommend that you search for common js judgment functions.
*Determines whether the specified content is null. If it is null, a warning box is displayed.*/Function
Tested to match double-byte characters (including Chinese characters): [^/x00-/xFF] is very easy to use.
2 recommended web http://mscenter.edu.cn/blog/yongsheng/archive/2004/11/19/308.html
This guy has a lot of regular expressions.
Keyword: Regular
Tested to match double-byte characters (including Chinese characters): [^/x00-/xFF] is very easy to use.
2 recommended web http://mscenter.edu.cn/blog/yongsheng/archive/2004/11/19/308.html
This guy has a lot of regular expressions.
Keyword:
Only numbers are allowed: "^ [0-9] * $ ".Only n digits can be entered: "^ \ D {n} $ ".You can only enter at least N digits: "^ \ D {n,} $ ".Only M ~ can be input ~ N-digit :. "^ \ D {m, n} $"Only numbers starting with zero and non-zero can be
Summary of common Regular Expressions in C #
A newbie must pay attention to the manual, which can save a lot of writing.CodeTime, China self-learning Programming Network for new friends to sort out the release. Only numbers are
1.
VaR Reg =/^ (\ w | [\ u4e00-\ u9fa5]) * $ /;If (ARR = username. Match (REG )){Ti = 1;Return ture;}Else{Alert ("the user name can only contain English letters, numbers and Chinese characters. \ n check whether there are spaces or other symbols
Only numbers are allowed: "^ [0-9] * $ ".
Only n digits can be entered: "^ \ D {n} $ ".
You can only enter at least N digits: "^ \ D {n,} $ ".
Only M ~ can be input ~ N-digit :. "^ \ D {m, n} $"
Only numbers starting with zero and non-zero
C # Regular Expression
Only numbers are allowed: "^ [0-9] * $ ".Only n digits can be entered: "^ \ D {n} $ ".You can only enter at least N digits: "^ \ D {n,} $ ".Only M ~ can be input ~ N-digit :. "^ \ D {m, n} $"Only numbers starting with
C # Regular Expression matching Basics
Only numbers are allowed: "^ [0-9] * $ ".Only n digits can be entered: "^ \ D {n} $ ".You can only enter at least N digits: "^ \ D {n,} $ ".Only M ~ can be input ~ N-digit :. "^ \ D {m, n} $"Only numbers
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.